package demo01_SimpleFactory;


import demo01_SimpleFactory.model.Circle;
import demo01_SimpleFactory.model.Shape;
import demo01_SimpleFactory.model.Square;
import demo01_SimpleFactory.model.Triangle;

public class SimpleFactoryUtil {
    public static Shape getShape(String type) throws UnSupportedShapeException {
        if("circle".equalsIgnoreCase(type)) {
            return new Circle();
        } else if("square".equalsIgnoreCase(type)) {
            return new Square();
        } else if("triangle".equalsIgnoreCase(type)){
            return new Triangle();
        } else {
            throw new UnSupportedShapeException();
        }
    }
}
